package hradlo;

public class Main
{

	public static void main(String[] args)
	{
		iHradlo hradlo = new Hradlo();
		
		hradlo.setVstupA((short) 1);
		hradlo.setVstupB((short) 1);
		hradlo.setVstupC((short) 0);
		System.out.println(hradlo.getVystup());
	}

}

interface iHradlo
{
	int getVystup();

	void setVstupA(short a);

	void setVstupB(short b);

	void setVstupC(short c);
}

class Hradlo implements iHradlo
{
	short A = 2;
	short B = 2;
	short C = 2;

	@Override
	public int getVystup()
	{
		if (A == 2 || B == 2 || C ==2)
			return 2;
		return ((not(A)*B) + (A*B*C) + (A*not(B)*not(C)));
	}

	@Override
	public void setVstupA(short a)
	{
		if(a == 0 || a == 1)
			A = a;
		else
			System.out.println("Error. Input must be 1 or 0");
	}

	@Override
	public void setVstupB(short b)
	{
		if(b == 0 || b == 1)
			B = b;
		else
			System.out.println("Error. Input must be 1 or 0");
	}

	@Override
	public void setVstupC(short c)
	{
		if(c == 0 || c == 1)
			C = c;
		else
			System.out.println("Error. Input must be 1 or 0");
	}

	private short not(short number)
	{
		if (number == 0)
			return 1;
		if (number == 1)
			return 0;
		
		return 2;
	}
}